import mitmproxy.http
from mitmproxy import ctx


class Counter:
    def __init__(self):
        self.num = 0

    def request(self, flow: mitmproxy.http.HTTPFlow):
        self.num = self.num + 1
        # print(flow.request.host, '9999999999999999999999999999999')
        # print(flow.request.url, '9999999999999999999999999999999')
        # print(flow.request.method, '9999999999999999999999999999999')
        # print(flow.request.headers, '9999999999999999999999999999999')
        # print(flow.request.cookies, '9999999999999999999999999999999')
        ctx.log.info(f'8888888888888888888888888{flow.request.host}')
        ctx.log.info(f'9999999999999999999999999{flow.request.query}')
        ctx.log.info("We've seen %d flows" % self.num)
        if flow.request.host !='www.baidu.com':
            return


addons = [
    Counter()
]

